<!-- /* Description for file.
 * 简历-定置查询字段
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/resumes
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张朋2011年0713
 * @lastmodified  张海杰2011年0713
 */
 -->
 
<?php echo $javascript->link('jquery');
	echo $html->css ( 'style' );
	echo $html->css ( 'tab' );
?>
 <!--当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Resumesmanagements');//一级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('ResumeSettings',true));//当前操作地用span加粗?> 
	</tr>
</table>
</div>

<div class="tabflex" style="width:250px;">
<fieldset><legend><?php __('ResumeSettings');?></legend>
<table width="98%" cellspacing="0" cellpadding="0" border="0" style="text-align:left">
	<tr>
		<td>
		<select name="cx" id="cx" style="width:150px;">
		<?php for ($index = 0; $index < count($result2); $index++) {
			$displayname=$result2[$index]['fieldorders']['displayname'];
			$id=$result2[$index]['fieldorders']['id'];
			echo "<option  value='$id'>$displayname</option>";
		}?> 
		</select> 
		</td>
		<td width="35px">
			<a><?php echo $html->image('add.gif', array('title'=>'增加','style'=>'cursor:pointer;','onclick' =>'addSelectItem(document.getElementById("cx"))','border'=>'0','alt' =>  __('Add', true)));?></a>
<!--			 <input  type="button"   value="增加" onclick="addSelectItem(document.getElementById("cx"))" /> -->
		 </td> 
	 </tr>
	 <tr>
		<td>
			<select name="cmb" id="cmb" size=10 style="width:150px;">   
			<?php for ($index = 0; $index < count($result); $index++) {
				$displayname=$result[$index]['fieldorders']['displayname'];
				$id=$result[$index]['fieldorders']['id'];
				$ind=$result[$index]['fieldorders']['ind'];
				echo "<option  value='$id' class='its'>$displayname</option>";
			}?> 
			  </select>
 		</td>
		<td width="35px">
			<table cellspacing="10" cellpadding="0" border="0" >
				<tr>
					<td>
					<a><?php echo $html->image('fastforward_blue.gif', array('title'=>'上移','style'=>'cursor:pointer;','alt' => '上移','border'=>'0','onclick'=>'moveSel(-1)')); ?></a> 
					<!-- 上移 -->
					</td>
				</tr>
				<tr>
					<td>
					<a><?php echo $html->image('rewind_blue.gif', array('title'=>'下移','style'=>'cursor:pointer;','alt' => '下移','border'=>'0','onclick'=>'moveSel(1)'));?></a> 
					<!-- 下移 -->
					</td>
				</tr>
				<tr>
					<td>
					<a><?php echo $html->image('delete.gif', array('title'=>'删除','style'=>'cursor:pointer;','alt' =>  __('Delete', true),'border'=>'0','onclick'=>'deleteSelectItem(document.getElementById("cmb"))'));?></a> 
					<!-- 删除-->
					</td>
				</tr>
				<tr>
					<td>
					<a><?php echo $html->image('ok.gif', array('title'=>'保存','style'=>'cursor:pointer;','alt' =>  __('Save', true),'border'=>'0','class'=>'sub'));?></a> 
					<!-- 确定提交表单-->
					</td>
				</tr>
			</table>
<!--		  <input   type=button   value="上移"   onclick="moveSel(-1)" ></input> -->
<!--		  <input   type=button   value="下移"   onclick="moveSel(1)" ></input>       -->
<!--		  <input   type=button   value="删除"  onclick="deleteSelectItem(document.all.cmb)" ></input>  -->
<!--		  <input type="button" value="确定" class="sub" /> -->
		</td>
	</tr>
</table>
</fieldset>
</div>

  <form action="<?php echo ROOT_WEB_PATH; ?>/resumes/resumerecordsset" method="post" id="f1">
	<input type="hidden" name="records" class="records"/>
  </form>
  <script   language="javascript">   
  function   moveSel(nDir)   
  {   
  		var cmb = document.getElementById("cmb");
		if(cmb.selectedIndex   <   0)   
		return;   
    
      if(nDir   <   0)   
      {   
	if(cmb.selectedIndex   ==   0)   
  return;   
      }   
      else   
      {   
  if(cmb.selectedIndex   ==   cmb.options.length-1)   
  return;   
      }   
        
      var   opt   =   cmb.options[cmb.selectedIndex];   
      var   otheropt   =   cmb.options[cmb.selectedIndex+nDir];   
    
      var   text   =   opt.text;   
      var   value   =   opt.value;   
            
      opt.text   =   otheropt.text;   
      opt.value   =   otheropt.value;   
    
      otheropt.text=text;   
      otheropt.value     =   value;   
    
      cmb.selectedIndex   +=   nDir;   
  }   

  function deleteSelectItem(oSelect)
{
     for(var i=0; i<oSelect.options.length; i++)
     {
         if(i>=0 && i<=oSelect.options.length-1 && oSelect.options[i].selected)
         {
             oSelect.options[i] = null;
             i --;
         }
     }
}

  function addSelectItem(oSelect)
  {
	 var toSelect = document.getElementById("cmb");
	 for(var i=0; i<oSelect.options.length; i++)
     {
	    
         if(i>=0 && i<=oSelect.options.length-1 && oSelect.options[i].selected)
         {
             var ops=document.getElementById("cmb");;
             var va=oSelect.options[i].value;
             var m=0;
             for(var j=0; j<ops.options.length; j++)
             {
				if(ops.options[j].value==va)
				{
					m=1;
					break;
				}
             }
        	 if(m==0)
        	 {
			 	var opt=document.createElement("option");
            	opt.innerHTML=oSelect.options[i].innerHTML;
             	opt.value=oSelect.options[i].value;
			 	toSelect.appendChild(opt);
             	break;
        	 }
        	 else
        	 {
				alert("该字段已添加");
             }
         }
     }
  }
  $(function(){
		$(".sub").click(function(){
			var s="";
			$("#cmb > option").each(function(i){
				var ind=i+1;
				var id=$(this).val();
				s=s+id+"-"+ind+"|";
				});
			$(".records").val(s);
			$("#f1").submit();
			});
	});
  </script>   




